fix: repair all failing tests and type errors#46
Open
stooit wants to merge 1 commit into
Open
Conversation
- shared: rename User field userName -> username for cross-package consistency - api/users route: import missing badRequest error helper - api/auth middleware: fix case-sensitive HTTP method allowlist (post -> POST) - shared/pagination: implement paginate() per test contract - tsconfig: use bun-types so bun:test and process globals resolve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and TypeScript errors across the
apiandsharedpackages. Final state: 22 pass / 0 fail andtsc --noEmitexits 0.Root causes & fixes
User.userNamerenamed tousername(lowercase) to match every consumer (db, route handler, and all tests). This was the source of theusernametype errors and thePOST /usersvalidation failure.routes/users.tsusedbadRequestwithout importing it fromlib/errors; added to the import."post", but Hono'sc.req.methodis uppercase, so unauthenticated POSTs were wrongly forced through the auth check. Changed to"POST".paginate()inshared/utils/pagination.tsper the test contract (page slice, partial last page, total/totalPages rounding, out-of-range page, empty array)."types": ["bun-types"]sobun:testandprocess/Bun globals resolve, clearing the remaining tsc errors. (bun-typeswas already installed — no new dependency.)Verification
bun test-> 22 pass, 0 failnpx tsc --noEmit-> 0 errorsConstraints honoured
Assumptions / notes
username(lowercase) because the immutable tests use that spelling consistently.paginate()does not guardsize <= 0. No test exercises this and page size is not user-controllable today, so it was left out per "fix only what the tests require" — flagged for future hardening.